<style>
    .layui-form .layui-form-item .layui-inline .layui-form-label {
        width: 150px;
        font-size: 18px;
        font-weight: bold;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline input{
        width: 400px;
        font-size: 17px;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline textarea{
        width: 400px;
        font-size: 17px;
    }
</style>
<form class="layui-form  seller-alone-form" id="userAdd" style="padding:20px;height: 600px;">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">Title：</label>
            <div class="layui-input-inline">
                <input type="text" value="" name="title" id="title"
                       lay-verify="required"
                       lay-verType="tips"  class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline" >
            <label class="layui-form-label">Desc：</label>
            <div class="layui-input-inline" style="width: auto">
                    <textarea name="desc" style="padding-left: 2px;display: none;"
                     id="desc" class="layui-textarea"></textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">NoSend：</label>
            <div class="layui-input-inline">
                <input type="text" value="" name="no_send"
                       lay-verType="tips"  class="layui-input">
            </div>
        </div>
    </div>
    <br/>
    <div class="layui-input-inline">
        <input type="text" value="" name="email_array" id="email_array" style="width:1000px;font-size: 20px;color:green"
               lay-verType="tips"  class="layui-input">
        <br />
        <span style="padding-left: 200px;font-size: 20px;color:red">NoSend:排除不发的邮箱','连接,例:checkgiftbox@outlook.com,outletapple.llh@gmail.com</span>
    </div>


    <div class="layui-form-item" style="padding-top: 100px;">
        <div class="layui-input-block">
            <button type="button" class="layui-btn" lay-submit lay-filter="save">confirm</button>
        </div>
    </div>
</form>

<script>
    layui.use(['form','layedit'], function () {
        var form = layui.form;
        var layedit = layui.layedit;
        var editIndex = layedit.build('desc');

        form.on('submit(save)', function(data){
            data.field.desc = layedit.getContent(editIndex);
            const loading =parent.layer.load(1, {shade: [0.1,'#fff']});
            JsPost("{:url('sendEmail')}", data.field, function(res){
                parent.layer.close(loading);
                if (res.code > 0) {
                    $('#email_array').val(res.data);
                    layer.msg(res.msg, {time: 1500, icon: 1});
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 2});
                }
            });
        });
    });
</script>
